import com.smart.dao.RecorderDao;
import com.smart.domain.Recorder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests;
import org.springframework.transaction.annotation.Transactional;
import org.testng.annotations.Test;

import java.util.ArrayList;
import java.util.List;

@ContextConfiguration("classpath*:/recorder-context.xml")
@Rollback(false)

public class Mytest extends AbstractTransactionalTestNGSpringContextTests {
    @Autowired
    private RecorderDao recorderDao;


    @Test
    public void testdao() {
        Recorder cp =new Recorder();

        cp.setRecorder_courseName("英语");
        cp.setRecorder_teacherName("王磊");
        cp.setRecorder_computerRoom("机房三");
        cp.setRecorder_lesson("zuoye ");
        cp.setRecorder_classes("计科161");
        cp.setRecorder_week(13);
        cp.setRecorder_weekNumber(10);
        cp.setRecorder_startTime(60);
        cp.setRecorder_stopTime(100);
        recorderDao.addRecorder(cp);

    }

    @Test
    public void testdaoupdate(){
        Recorder recorder2 =new Recorder();
        recorder2.setRecorder_week(9);
        recorder2.setRecorder_weekNumber(4);
        int a= recorderDao.updateRecorder(recorder2);
        if(a>0){
            System.out.print("修改成功");
        }
        else{
            System.out.print("修改失败");
        }
    }
    @Test
    public void testdeletedao(){
        Recorder recorder3 = new Recorder();
        recorder3.setRecorder_computerRoom("机房一");
        int a=recorderDao.deleteRecorder(recorder3);
        System.out.println(a);
    }


    @Test
    public  void testquery(){
        Recorder com =new Recorder();
        com.setRecorder_computerRoom("机房三");
        recorderDao.queryRecorder(com);
    }

    @Test
    public  void testquerylist(){
        Recorder com= new Recorder();
        recorderDao.querylistRecorder(com);
    }

}

